package cn.darkhorse.common.report.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author yuanjun
 * @since 2021/8/13 9:38
 */
public class DataHandlerHelper {

    public static final String VAL_LIST = "valList";
    public static final String COL_LIST = "colList";


    /**
     * 获取报表中的数据值
     * @param value
     * @return
     */
    public static List<Map<String, Object>> getValList(Map<String, Object> value) {
        List<Map<String, Object>> valList;
        if (null == value.get(VAL_LIST)) {
            valList = new ArrayList<Map<String, Object>>();
        }else {
            valList = (List<Map<String, Object>>) value.get(VAL_LIST);
        }

        return valList;
    }

    /**
     * 在科目前添加空格
     * @param subject
     * @param level
     * @return
     */
    public static String getSubject(String subject,Integer level) {
        for (int i = 0; i < level; i++) {
            subject = "  " + subject;
        }
        return subject;
    }
}
